export class AnimatorTransition {
    constructor(options) {
        this.from = options.from;
        this.to = options.to;
        this.paramName = options.paramName;
        this.paramValue = options.paramValue;
        this.playRate = options.playRate || [0, 1];
        this.action = options.action || "equals";
    }

    isOk(value) {
        let result = false;

        switch (this.action) {
            case "self":
                let fromRate = this.from.playRate;
                result = this.playRate[0] <= fromRate && fromRate <= this.playRate[1];
                break;

            case "equals":
                result = value == this.paramValue;
                break;

            case "less":
                result = value < this.paramValue;
                break;

            case "greater":
                result = value > this.paramValue;
                break;

            case "notEqual":
                result = value != this.paramValue;
                break;
        }

        return result;
    }
}